/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OHOS_HMFS_RESIZE_LOAD_SB_H
#define OHOS_HMFS_RESIZE_LOAD_SB_H

#include <iostream>
#include "hmfs_data.h"
#include "hmfs_utils.h"
#include "resize_data.h"
#include "resize_utils.h"
#include "resize_load.h"

namespace OHOS {
namespace Hmfs {
class ResizeLoad;
class ResizeLoadSb{
public:
    ResizeLoadSb(ResizeLoad *loadPtr);
    ~ResizeLoadSb() = default;
    int32_t SetFeature(int32_t feature);
    void CheckSetFeatures(SB_ADDR sb_addr);
    int32_t CheckAddrBoundary(struct SuperBlockData *superBlock, enum SB_ADDR sbAddr);
    int32_t VerifySbChecksum(struct SuperBlockData *superBlock);
    int32_t CheckSuperBlock(struct SuperBlockData *superBlock, enum SB_ADDR sbAddr);
    bool isCheckpointStop(struct SuperBlockData *superBlock, bool abnormal);
    bool isInconsistentError(struct SuperBlockData *superBlock);
    int32_t ValidateSuperBlock(SB_ADDR sbAddr);
    int32_t CheckSectorSize(struct SuperBlockData *superBlock);
	int32_t HmfsLoadSbData();
private:
    ResizeLoad *load_;
    std::shared_ptr<HmfsConfigData> config_; /** config */
    std::shared_ptr<HmfsSbInfo> sbInfo_; /** sbi */
};

}
}
#endif
